package com.myHospital.service;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.myHospital.biz.DepartmentsBiz;
import com.myHospital.entity.Departments;

@Controller
public class UserAction {
	
	@Autowired
	private DepartmentsBiz departmentsBiz;
	
	@RequestMapping("/DepartmentList")
	public String InitDepartmentList(Model model,HttpServletRequest request,HttpServletResponse response)
	{
		String hid=request.getParameter("hid");
		String did="0";
		if(!(request.getParameter("did")==null||request.getParameter("did").equals("")))
		{
			did=request.getParameter("did");
		}
		List<Departments> list=departmentsBiz.getByDetailId(Integer.parseInt(hid), Integer.parseInt(did));
		System.out.println("hid="+hid);
		System.out.println("did:"+did);
		System.out.println("list:"+list.size());
		
		model.addAttribute("bigDepartmentsList", list);
		
		return "app/department_list";
		
	}
	@RequestMapping("/hosManager")
	public String hosManager(Model model)
	{
		return "developer/dev-list";
	}


}
